﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Globalization;


namespace XWord.WPF.ApplicationFramework.Validations
{
    public class RegularExpressionValidator : Validator
    {
        public override bool Validate()
        {
            string str = Property.ToString();
            if (string.IsNullOrEmpty(str))
            {
                return true;
            }
            Match match = Regex.Match(str, this.Pattern);
            return ((match.Success && (match.Index == 0)) && (match.Length == str.Length));
        }

        public virtual string Pattern { get; set; }
    }
}
